package com.authstr.auth.mapper.inter;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.authstr.auth.constant.CacheKey;
import com.authstr.auth.constant.CacheName;
import com.authstr.auth.entity.MenuNode;
import com.authstr.model.base.BaseMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Map;

@Mapper
public interface MenuDao extends BaseMapper<BaseMenu> {
    Page query(@Param("page") Page page, String name);

    List<Map> getAll(String name, String exclude_id);

    List<BaseMenu> getLikeParentIds(Long id);

    List<Long> getMenuIdByRoleId(Long roleId);

    @Cacheable(value = CacheName.SHIRO_CACHE ,key = "'" + CacheKey.MENU_URL_BY_ROLEID_ + "'+#roleId")
    List<String> getMenuUrlByRoleId(Long roleId);

    /**
     * 通过角色id集合,获取 菜单树节点 集合
     * @param roleIds
     * @return
     */
    List<MenuNode> getMenuNodeByRoleIds(@Param("params") Map params);
}
